import request from '@/utils/request'

// 登录方法
export function login(username, password) {
    const data = {
        username,
        password
    }
    return request({
        url: '/auth/login',
        headers: {
            isToken: false
        },
        method: 'post',
        data: data
    })
}

export function loginByCode(code, redirectUri) {
    const data = {
        code,
        redirectUri
    }
    return request({
        url: '/auth/login-by-code',
        headers: {
            isToken: false
        },
        method: 'post',
        data: data
    })
}

export function refreshToken(data) {
    return request({
        url: '/auth/refresh-token',
        headers: {
            isToken: false
        },
        method: 'post',
        data: data
    })
}

export function logout(data) {
    return request({
        url: '/auth/logout',
        headers: {
            isToken: false
        },
        method: 'post'
    })
}

export function getUser() {
    return request({
        url: '/user/get',
        headers: {
            isToken: false
        },
        method: 'get'
    })
}
